package com.cfpl.project_common.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @TableName warehouse
 */
@TableName(value ="warehouse")
@Data
public class Warehouse implements Serializable {
    /**
     * 仓库id
     */
    @TableId(type = IdType.AUTO)
    private Long warehouseId;

    /**
     * 仓库地址
     */
    private String warehouseAddress;

    /**
     * 入仓日期
     */
    private Date warehouseInDate;

    /**
     * 管理仓库人员,fk
     */
    private Long adminId;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品单价
     */
    private BigDecimal productPrice;

    /**
     * 产品总数量
     */
    private Integer productNumber;

    /**
     * 产品销售数量
     */
    private Integer productSellNumber;

    /**
     * 果蔬进场id,fk
     */
    private Long vegetableEntryId;
    /**
     * 果蔬识别码
     */
    private String identifyCode;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Warehouse other = (Warehouse) that;
        return (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()))
            && (this.getWarehouseAddress() == null ? other.getWarehouseAddress() == null : this.getWarehouseAddress().equals(other.getWarehouseAddress()))
            && (this.getWarehouseInDate() == null ? other.getWarehouseInDate() == null : this.getWarehouseInDate().equals(other.getWarehouseInDate()))
            && (this.getAdminId() == null ? other.getAdminId() == null : this.getAdminId().equals(other.getAdminId()))
            && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
            && (this.getProductPrice() == null ? other.getProductPrice() == null : this.getProductPrice().equals(other.getProductPrice()))
            && (this.getProductNumber() == null ? other.getProductNumber() == null : this.getProductNumber().equals(other.getProductNumber()))
            && (this.getProductSellNumber() == null ? other.getProductSellNumber() == null : this.getProductSellNumber().equals(other.getProductSellNumber()))
            && (this.getVegetableEntryId() == null ? other.getVegetableEntryId() == null : this.getVegetableEntryId().equals(other.getVegetableEntryId()))
            && (this.getIdentifyCode() == null ? other.getIdentifyCode() == null : this.getIdentifyCode().equals(other.getIdentifyCode()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
        result = prime * result + ((getWarehouseAddress() == null) ? 0 : getWarehouseAddress().hashCode());
        result = prime * result + ((getWarehouseInDate() == null) ? 0 : getWarehouseInDate().hashCode());
        result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getProductPrice() == null) ? 0 : getProductPrice().hashCode());
        result = prime * result + ((getProductNumber() == null) ? 0 : getProductNumber().hashCode());
        result = prime * result + ((getProductSellNumber() == null) ? 0 : getProductSellNumber().hashCode());
        result = prime * result + ((getVegetableEntryId() == null) ? 0 : getVegetableEntryId().hashCode());
        result = prime * result + ((getIdentifyCode() == null) ? 0 : getIdentifyCode().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", warehouseId=").append(warehouseId);
        sb.append(", warehouseAddress=").append(warehouseAddress);
        sb.append(", warehouseInDate=").append(warehouseInDate);
        sb.append(", adminId=").append(adminId);
        sb.append(", productName=").append(productName);
        sb.append(", productPrice=").append(productPrice);
        sb.append(", productNumber=").append(productNumber);
        sb.append(", productSellNumber=").append(productSellNumber);
        sb.append(", vegetableEntryId=").append(vegetableEntryId);
        sb.append(", identifyCode=").append(identifyCode);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}